home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Languguage OS 2
/
Languguage OS II Version 10-94 (Knowledge Media)(1994).ISO
/
language
/
embedded
/
develop
/
libsrc11.arc
/
RDBLKAD.C
< prev
next >
Wrap
C/C++ Source or Header
|
1989-04-27
|
1KB
|
54 lines
/* rdblkad.c 4.4 */
/*F****************************************************************************
FUNCTION NAME: rdblkad
ACTION: Reads count characters from the A to D hardware
to an array of short.
PARAMETERS:
array: pointer to an array of bytes that is filled with
the A to D data.
count: number of bytes to read from the A to D ports.
RETURNS: (void)
******************************************************************************/
#define ATODLINES 4 /* number of A to D conversion registers */
#include <hc11/io.h>
#include <hc11/atod.h>
#include <hc11/config.h>
#include <hc11/directives.h>
SMALL
void rdblkad(array, count)
unsigned short *array; /* pointer to data to be read */
int count; /* number of bytes to be read */
{
unsigned short i;
HC11.OPTION |= ADPU;
while (count > 0)
{
HC11.ADCTL = HC11.ADCTL; /* force conversion */
while ((HC11.ADCTL & CCF) == 0)
; /* null statement */
for (i=0;(i<ATODLINES) && (count>0);i++,count--)
*(array++) = HC11.ADR[i];
} /* end of while count > 0 */
} /* end of rdblkad */